import 'package:flutter/material.dart';
import 'package:flutterdemo/common/calc.dart';
class IconRight extends StatelessWidget {
  Widget? icon;
  String name; 
  String routeName;
  Widget? rightWidget;
  GestureTapCallback? onTab;
  IconRight({this.icon,this.name="",this.routeName="",this.onTab,this.rightWidget});

  @override
  Widget build(BuildContext context) {
    Calc.init(context);
    return  Ink(
      color: Colors.white,
      child: InkWell(
        onTap: onTab??() {
          if(routeName!=""){
            Navigator.pushNamed(context, routeName);
          }
        },
        child: Container(
          padding: EdgeInsets.all(Calc.width(30)),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              icon??Container(),
              icon==null? Container() :SizedBox(
                width: Calc.width(20),
              ),
              Expanded(
                flex: 1,
                child: Text(name),
              ),
              rightWidget??SizedBox(),
              Icon(
                Icons.arrow_forward_ios,
                size: Calc.width(36),
                color: Colors.grey,
              )
            ],
          ),
        ),
      ),
    );
  }
}